<?php

namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendReminderEmail extends Job implements SelfHandling, ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //
        $name = '客户你好-发布图片3';
        $flag = \Mail::send('admin.test', ['name' => $name], function ($message) {
            $to = '1020472637@qq.com';
            $message->to($to)->subject('测试邮件');
        });
        if ($flag) {
            echo '发送邮件成功，请查收！';
            //return view('admin.test', ['name' => $name, 'imgPath' => $imgPath]);
        } else {
            echo '发送邮件失败，请重试！';
        }
    }
}
